SYNTAX ZX80
A PUBLICATION OF THE HARVARD GROUP
VOL. 2 NO. 8 ISSN 0273-2696 AUG. , 1981
MICROACE TO DISCONTINUE KITS
MicroAce is phasing out its
computer kits. According to Bill
Clark of MicroAce, Sinclair didn't
renew MicroAce' s license. The
company also scrapped plans for a
kit using larger ROM. "We can't
compete with the ZX81 in price,"
Clark Sjaid. Other projects
continue, however. MicroAce plans
upgrade kits for machines , and
video boards are in production.
CAI PRINTER UPDATE
CAI Instruments will offer
software components to make their
Widget printer compatible with both
4K and 8K ROMs.
Since the ROMs have different
character sets, CAI designed two
different EPROMs (Erasable Program-
mable ROMs) to direct their
printer. If you ordered a 4K-
compatible printer and have bought
an 8K ROM since then, you can
exchange EPROMs for $ 10, according
to CAI's Bob Swann. He also said
that you can order both EPROMs at
the same time by adding $15 to the
Widget's price of $99.95. Contact
CAI Instruments, Inc., PO Box 446,
Midland, MI 48640 or call
517/835-6145.
ZX80/ZX81 USERS CLUB
The ZX80/ZX81 Users Club in
Surrey, England serves all users,
beginner to expert. For an annual
membership of £6 in the UK (£10
overseas), you get a newletter,
software, and technical assistance.
Write to PO Box 159, Kingston Upon
Thames , Surrey England KT2 5UQ .
FOR SYNTAX READERS ONLY
Sinclair now offers used ZX80s
for only $49.95. According to
Nigel Searle of Sinclair, most of
these machines were sold in England
as kits and assembled incorrectly.
All items included in the
package are used. You'll get a
complete (but not necessarily
working) ZX80 and an instruction
manual. At least the major ICs
will be socketed.
You will not get, however, an
AC adapter, transfer switch, or
video or cassette cables. They are
available for an extra $15. There
is no warranty on used ZX80s.
If you need an extra computer
for spare parts or just want to
tinker with one, send your order
marked "Special kit offer" with a
check or money order to Sinclair
Research Ltd. , 50 Staniford St. ,
Boston, MA 02114.
ZX80 P0CKETB00K
THE ZX80 P0CKETB00K is now
available from SYNTAX for $14.95
plus $1.50 shipping & handling.
The 110-page book reviews 4K BASIC
and provides program listings for
games. Appendices explain error and
Z80 machine language codes. Send
check or credit card number (Visa,
MasterCard, Amex, Diner's) with
expiration date to SYNTAX, RD 2 Box
457, Bolton Rd. , Harvard, MA 01451
or call 617/456-3661.
EZUG's Eric Dees on asks those
interested in subscribing to the
EZUG newsletter (Jun. 81 p.l) to
send $2 postage for one issue, $10
for six.
1
SYNTAX ERRORS
In LETTERS last month, we
defined RND(J) in 4K as setting the.
random number generator to J.
RND(J) actually gives a random
number between 1 and J.
Mel Routt asks that line 115
of his Loan Amortization program
(July 81) be changed, to:
115 IF A$="NO" THEN GO TO 10
Here are corrections to 30
PROGRAMS FOR THE SINCLAIR ZX80 by
Melbourne House, courtesy of Image
Computer Products, Inc.:
Noughts and Crosses, p.26
610 GO TO 790
Nim, p. 34
690 IF T (0) > 0 THEN GO TO 745
745 FOR R = 1 TO 3
Blackjack, p. 40
780 IF N(2) = 21 AND N(0) = 1
THEN LET W - 2
Bubble Sort, p.42
130 LET L = N + K - I
Maths Drill, p. 70
670 STOP
Life, p.77
450 NEXT I
460 FOR I = 9 TO 55
Prime Numbers , p . 79
150 IF X / A(R) > A(R) THEN GO TO
180
Simultaneous Equations, p.82
610 IF NOT D / GCD = S THEN
PRINT "/" ; ABS (D / GCD);
Chomp, p.95
140 LET A(0) = 53
325 PRINT
Capitals of the World, p.73
(The second line numbered 430
should be 440, the line numbered
440 should be 450, and the line
numbered 450 should be 460.)
DATA FILE FORMAT
Here's a program for 2K
MicroAces that allows you to create
indexed files on tape. Changes for
IK RAM follow the listing.
In this, listing, I put some
data in place to give you an idea
of how the program works . It takes
a filename, a table of contents
indexed to line numbers in the
program, and text. To start your
own file, delete lines 100-115 and
OUR POLICY ON CONTRIBUTED MATERIAL
SYNTAX ZX80 invites you to express opinions i elated to the ZX80 and the
newsletter. We will print, as space allows, letters discussing items of general interest.
Of course, we reserve the right to edit letters to a suitable length and to refuse
publication of any material.
We welcome program listings for all levels of expertise. Programs can be for
any fun or useful purpose. We will test run each one before publishing it, but we
will not debug programs; please send only workable listings.
In return for your listing, we will pay you a token fee of $2.00 per program we
use. This payment gives us the nonexclusive right to use that program in any form,
world-wide. This means you can still use it, sell it, or give it away, and so can we.
We will consider submissions of news and hardware or software reviews. Please
keep articles short (350-400 words). Again, we reserve the right to edit accepted
articles to a suitable length. We will pay 7 cents per 6 characters, including spaces
and punctuation, for accepted articles.
When you send in programs for possible publication in SYNTAX, please
include the following information:
• How to operate the program, including what to input if it does not contain
prompts.
• Whether you can run the program over again and how.
• How to exit the program.
• The Syntactic Sum (using the Syntactic Sum program in the February, 1981,
issue).
• Whether it fits in IK or 2K RAM (or 16K when available).
• Whether it uses the 4K or 8K RAM.
We pay for this explanatory text at the same rate as for articles in addition to
payment for the program itself.
If you want us to return your original program listing or article, please include
a self-addressed, stamped envelope. Otherwise, we cannot return submitted material.
SYNTAX ZX80 is published monthly
by Syntax ZX80, Inc., a wholly-owned subsidiary of
The Harvard Group, RD 2, Box 457, Bolton Road,
Harvard, MA 01451. Telephone 617/456-3661.
Subscriptions: 12 issues, $25. Single issue, $4.
Publisher: Kirtland H. Olson
Editor: Ann L. Zevnik
Associate Editor: Susan G. Barber
Technical consultant: Eric K. Olson
Printed by Joseph E. Marhefka, Jr.
Clinton Offset Printers
Clinton, MA 01510
© Syntax ZX80, Inc., 1981. All rights reserved.
Photocopying prohibited. ISSN 0273-2696
2
500-515. Then SAVE on tape (make a
master copy for other files) .
LOAD a blank format tape and
put your filename in the PRINT
statement at line 100. Then add
the table of contents (copying the
format shown in the sample listing)
in lines 100 through 299. Enclose
information in PRINT statements
between lines 500 and 4999.
Separate blocks of text with GO TO
5000 statements. Type LIST (NL) so
you can add the next line to your
table of contents.
When you finish typing data,
hit RUN (NL). Your table of
contents will be displayed with a
numeric prompt. Select the desired
category and enter its number and
NEWLINE. Data will be shown with a
" " prompt. Keying (NL) returns
you to your table of contents.
The routine at 9000 allows you
to check how much unused RAM space
you have before entering new data.
After you get the program listing,
enter RUN 9000 (NL) . Hit any key
to return to the listing.
To exit program, type STOP
(NL) (NL). Then SAVE this finished
program on tape. If you can't get
all the information you want on any
one program, LOAD a clean format
tape. Title it and go from there.
Keep a paper log of your file
tape to locate data easily.
John D. Andrews, San Jose, CA
10 PRINT DATA FILE"
20 PRINT (shift W)
30 PRINT
40 PRINT "IF PROMPT= QUOTES -
KEY NEWLINE"
50 PRINT
60 PRINT /'DATA LISTING"
70 PRINT "
(32 dashes)
80 PRINT " DATA
LINE NO."
90 PRINT "
" (32 dashes)
100 PRINT " AUTOMOTIVE"
110 PRINT "TIRES" , , , " 500"
115 PRINT "TIMING" , , ,"510"
300 INPUT A
301 CLS
302 GO TO A
500 PRINT " SIZE= H78-15. PRES
SURE= 30 PSI"
505 GO TO 5000
510 PRINT " 3 DEGREES BTDC"
515 GO TO 5000
4999 STOP
5000 INPUT A$
5001 IF A$=" " THEN CLS
5002 GO TO 70
9000 CLS
9001 LET P=1 8432-PEEK (16400) -PEE
K ( 1640 1 ) *256
9002 PRINT P;" BYTES LEFT"
9003 LET T=2048-P
9004 PRINT /'BYTES USED= ";T
9005 STOP
Syntactic Sum: -23289, 4K
MODIFICATIONS FOR IK RAM
line 9001: change 18432 to 17408.
line 9003: LET T=1024-P.
Use GO SUB 5000 between blocks
instead of GO TO 5f>nn
New syntactic Sum: -23264, 4K
LOAN AMORTIZATION REVISITED
Those who have 8K ROM with
only IK RAM can modify Mel Routt's
Loan Amortization program (July 81)
to rim in their machines . Delete
lines 1-9, 105-535. In line 95,
insert a space between PAYMENT and
. Add the following lines :
91 PRINT
105 PRINT "ITS A PLEASURE TO SE
RVE YOU. TO PROCESS ANOTHER L
OAN PRESS NEWLINE . "
110 INPUT X$
115 IF X$="" THEN GOTO 10
120 STOP
500 LET X=(INT (100*(X+(.005)))
)/100
505 RETURN
(NOTE: The double quotation marks
on line 115 are shifted P's. And
we tried but couldn't change it to
fit in 4K ROM. Anv takers? — SB)
Syntactic Sum: 24757, 8K
3
HARDWARE REVIEW: LJH'S KEYBOARD
I tested LJH Enterprises'
pre-wired keyboard. Their ad says
"wired keyboard hooks up in min-
utes , " but this proj ect may take
beginners 1-2 hours. (Of course,
more experienced solderers will
finish faster.)
The keyboard nicely improves
typing on my ZX80. It is narrower
(from A to NL) than other big
keyboards (like typewriters) and
requires a firm touch, but causes
no problems with typing. It comes
with all keys wired and a cable of
wires to solder to ZX80 components.
The package also includes 3 pages
of directions and 3 pages of
diagrams, plus rub-down transfer
letters to. relabel keys . The
keyboard has no extra keys to
confuse you as some surplus boards
might (although the key for NEWLINE
is labelled DELETE on my keyboard) .
Otherwise, all keys correspond to
those on ZX80/ MicroAce keyboards.
Although the keyboard works
perfectly and greatly increases my
typing speed and accuracy, I wasn't
so thrilled with it while I was
soldering it. The directions may
be clear to experienced people, but
were not entirely clear to me. I
expect that primarily non-hardware
people would rather pay $75 for the
pre-wired keyboard than build their
own or buy LJH's kit despite the
cost savings, so the instructions
to hook it up should be clear and
exact. They don't warn you that
you need some soldering skill to
connect the wires. They don't tell
you to disconnect your computer
before starting, or how to take off
the cover, or what to do if some-
thing doesn't work. (Beginners--
see hints following for help with
opening your computer and soldering
wires.) On the other hand, Leonard
Holmberg of LJH is very ready and
available to offer advice and
clarification over the phone. He
even offered to connect my keyboard
for me when I said I had a little
trouble. He has connected other
people's as well.
If you can handle a soldering
iron but do not care to construct
an entire keyboard, LJH's pre-wired
keyboard is wonderful. With some
patience and the advice below, even
beginners can connect it and enjoy
that thrill of accomplishment.
Wired keyboard with plans ,
$75.00 + $5.00 mailing in US, LJH
Enterprises, P.0. Box 6273, Orange,
CA, 92667, 714/772-1595.
SOLDERING HINTS
Even if you're not a hardware
person, you can connect external
devices to your computer without
fear. You only need a few hints to
successfully solder your ZX80.
First, disconnect the power
and video cables and remove the
computer's cover. With a pin or
paper clip, push down on the
centers of the plastic rivets
holding the case together until
their cores pop out. Flip the
computer over, squeeze each rivet
together, and push it out. Don't
lose these pieces 1 Turn the ZX80
back over and lift off its cover.
Strip about 1/8"- 1/4" of insu-
lation off the end of the wire with
wire strippers or a penknife. If
the wire you want to solder is
stranded (made out of several tiny
wires inside the insulation) , twirl
the wires between your fingers to
roll them into 1 thick wire. Tin
the wire before you solder it to
help get a good heat transfer and
solder joint. (Tinning means melt-
ing a little solder with the iron
onto the wire before using it.)
If you're soldering onto a
wire already on the board, bend the
tinned exposed wire over your
fingernail or around a small pliers
into a hook. Hook the bent wire
around the other wire on the board
(not completely around — you might
want to get it off some day) .
Touch the iron to the joint to
heat it and touch the solder to the
4
hot joint, allowing it to melt. If
the wire is light and the hook
won't stay where you put it, clip a
wooden clothespin to the wire about
an inch behind the exposed part.
The heavy clothespin will keep
tension on the hook and prevent it
from slipping as you solder.
If your device doesn't work
when you finish, you may have a
cold solder joint. To fix this,
reheat the joint until the solder
melts. Pull the wire gently to
make firm contact with the compo-
nent, then let solder cool.
Replace the cover and squeeze
rivets together to fit them through
their holes . Push a center pin
into each rivet to secure it.
IN AND OUT OF MACHINE LANGUAGE
You usually talk to your
computer in BASIC, whose commands
are the keywords on your keyboard.
But when you use machine language
(ML) programs, you have no keys to
press directly. So we need to tell
the machine to RUN a ML program,
and to tell it to STOP.
USR(X) and USR X, on the 4K
and 8K ROM respectively, are BASIC
commands you can type on your key-
board that tell the computer to RUN
a ML program. X, called the argu-
ment of the command, is the address
of the first ML command in the
program. USR tells the ZX80 to go
to the address X and execute ML
until told to stop. Put your USR
call at the end of a BASIC program
POKEing ML commands (see Beginners '
Loading ML Programs, this issue).
But once you trans f er computer
control to a ML program, it will
never come back unless a RETURN
statement in the ML program tells
it to. This command sends the
computer back to BASIC. In decimal
ML programs, this command is 201
(C9 in hex) . Check that this is
the last command in any ML program
you run, or you'll have to pull the
plug to get your machine out of ML.
MMO-LCM PK€S€NT9
THE ZX80 HOME COMPUTER PACKAGE
Programs that every HOME COMPUTER should have:
Rapidly paint text and graphics on the screen. Store screen CHECKBOOK BALANCER
display on tape for later viewing or modification. Keep a running tabulation of your bank account. Reconciles
bank statement to current actual balance, and displays both.
COMPOSER Stores and displays up to 30 uncleared monthly transac-
tions.
Compos e elect ronic music. Store compositions on tape. Play
through tape recorder or broadcast to nearby AM radio. CALCULATOR
Bi rrrnmiir ... , an a on Give y° ur computer high-precision floating point arithmetic.
1 eiLLdUAnu Multiplies or divides two numbers ranging from .0000000001
Use your computer as a display center. Displays your mes- to 9999999999.
s ag e in giant letters which move continuously across the
s cree n. Save messages on tape.
Each package complete with cassette of programs, manual, reference cards, color keyboard overlays, and more. Requires
ZX80 or Micro Ace 4K BASIC, and 1 K of memory or more.
ALSO FROM LAMO-LEM: THE CHEST OF CLASSICS. FOUR CLASSIC
COMPUTER GAMES. UFE, LUNAR LANDER, MINDM ASTER, AND K-TREK
(MII H PHAS ORS. SCANNERS, VEW SCREEN, A WARP DRIVE).
CASSETTE, MANUAL, CHARTS. OVERLAYS. A MORE. 4K ROM, 1 K RAM, $9.95.
SEND FOR OUR CATALOG OF ZX80, MTCROACE, APPLE, AND Tl 57,
St A Si PRODUCTS. MCLUDMG FREE ZX80/M.ACE CODING SHEETS.
J9”
NO POSTAGE.
NO HANDLING.
NO SALES TAX.
LAMO-LEM LABS
CODE 108, BOX 2382, LA JOLLA, CA 92038
4K ROM: DISPLAY ROUTINE
DISPLAY begins the 4K ROM's
input/ output module at 013Ch, or
316d. We initialized system
variables D8FILE (D-FILE) , FRAMES,
RESULT, and CH8ADD (CH-ADD) using
EQUate statements at the beginning
of our assembly.
This routine controls sync,
ANNOTATED 4K ROM LISTING — DISPLAY
display, and keyboard scanning.
You can use it either by branching
from a USR routine into ROM or by
incorporating the module into your
own machine language (ML) program.
DISPLAY jumps back to BASIC
after execution. If you decide to
call it from the ROM, remember that
you'll have to jump back to ML with
another USR call.
013C
00100
ORG
013CH
4000
00110
Y
EQU
4000H
400C
00115
D8FILE
EQU
400CH
40 IE
00120
FRAMES
EQU
401 EH
4022
00 1 30
RESULT
EQU
4022H
4026
00140
CH8ADD
EQU
4026H
013C
CDAD01
00150
LD1
CALL
LD9
; SPACE BETWEEN LAST LINE OF
00160
; CHARS
AND FRAME SYNC
01010
;DISP -
- ENTER
HERE FROM BASIC TO DISPLAY RESULTS
01 3F
0608
01020
LD
B , 8
0141
1 0FE
01030
DJNZ
$
; WASTE 99- T-STATES
0143
2A1E40
01040
LD
HL, (FRAMES)
0146
23
01050
INC
HL
0147
221E40
0106Q
*
LD
(FRAMES) ,HL
01 4A
2 1 FFFF
01070
LD
HL, - 1
014D
06FE
01080
LD
B , 0FEH
01 4F
48
01090
LD
C,B
0150
ED78
01100
IN
A, (C)
; START FRAME SYNC
0152
F60 1
oiiio
OR
1
0154
F6E0
01120
LK3
OR
0E0H
0156
57
01130
LD
D,A
; ZERO BIT FOR EACH KEY THAT
0157
2F
01140
CPL
; IS PRESSED
0158
FE01
01150
CP
1
015A
9F
01160
SBC
A, A
; 0 IF ANY KEY PRESSED, -1 IF NONE
01 5B
B0
01170
OR
B
015C
A5
01180
AND
L
; CLEAR THE BIT FOR THIS ROW IN
01 5D
6F
01190
LD
L,A
;L IF ANY KEY DOWN
01 5E
7C
01200
LD
A,H
01 5F
A2
01210
AND
D
0160
67
01220
LD
H,A
0161
CB00
01230
RLC
B
ROM contents © Sinclair Research
0163
ED78
01240
IN
A, (C)
Ltd. , 1980. Reprinted by per-
0165
38ED
01250
JR
C , LK3
mission. Both Sinclair and Syntax
0167
IF
01260
RRA
ZX80 Inc. own copyright interests
0168
CB14
01270
RL
H
in this material.
01 6A
17
01280
RLA
016B
17
01290
RLA
01 6C
17
01300
RLA
016D
9F
01310
SBC
A, A
016E
E61 8
01320
AND
24
;0 IF US, 24 IF UK
0170
C620
01330
ADD
A, 32
6
0172 322340 01340 LD (RESULT+1),A ;32 IF US, 56 IF UK
01350 ;NOW L HAS 0 FOR EACH ROW IN WHICH A KEY OTHER THAN SHIFT
01360 ; IS PRESSED, H SIMILARLY FOR COLUMNS IN D1 TO D5, D6D7
01370 ; ONES , D0=0 IF SHIFT PRESSED, ELSE
01380 ; 7 1 7 T-STATES SINCE START OF FRAME SYNC, 545 BEFORE END
0175
ED4B2640
01390
LD
BC, (CH8ADD)
;PICK UP LAST TIME'S KEY
01400
; HITS , OR A
VALUE WITH D1 51 4=01 IF
0179
222640
01410
LD
( CH 8 ADD ) ,HL
; FIRST TIME ROUND
017C
78
01420
LD
A,B
01 7D
C602
01430
ADD
A, 2
01440 ;NOW EITHER CARRY IS CLEAR AND BC INDICATES A KEY WAS
01450 ; PRESSED OR CARRY IS CLEAR AND BC FFFFH OR FEFFH .
01460 ;NB NEITHER 0000H NOR FF00H IS A POSSIBLE VALUE FOR HL
01470 ; SINCE D6D7 OF H ARE SET & IF ALL OF D1 TO D5 OF H ARE
01480 ; SET THEN NO KEY IS PRESSED AND L = -1
017F
ED42
01490
SBC
HL,BC
;HL :=0 IF HL=BC AND
0181
EB
01500
EX
DE,HL
;C NOT FFH
0182
212240
01510
LD
HL, RESULT
0185
7E
01520
LD
A, (HL)
0186
B2
01530
OR
D
0187
B3
01540
OR
E
0188
C8
01550
RET
Z
; IF (X8PTR) =BC, A KEY IS PRESSED,
0189
78
01560
LD
A,B
; AND COUNT=0. EXIT WITH ADE=0
018A
FEFE
01570
CP
254
018C
9F
01580
SBC
A, A
;A:=0 IF NO KEY LAST TIME,-1 ELSE
018D
06 IF
01590
LD
B , 31
018F
B6
01600
OR
(HL)
; A:= (HL) IF NO KEY LAST TIME,
0190
A0
01610
AND
B
; -*1 ELSE *
0191
IF
01620
RRA
;NB SHIFTS IN A ZERO
0192
77
01630
LD
(HL) , A
0193
05
01640
DEC
B
0194
1 0FE
01650
DJNZ
$
; FRAME SYNC ENDS AT NEXT Ml
0196
D3FF
01660
OUT
(0FFH)
,A
vl^O
3EEC
01670
LD
A, -20
019A
0619
01680
LD
B,25
019C
2A0C40
01690
LD
HL, (D8FILE)
019F
CBFC
01700
SET
7,H
01 Al
CDAD0 1
01710
CALL
LD9
; DISPLAY SPACE ABOVE PICTURE AND
01A4
3EF3
01720
LD
A, -13
; 24 LINES OF TEXT
01A6
04
01730
INC
B
01A7
2B
01740
DEC
HL
01A8
FD3523
01750
DEC
( I Y+RESULT+ 1 - Y ) ;ONE LESS LINE BELOW
01 AB
1 88F
01760
JR
LDl
; PICTURE THAN ABOVE
01770
; SRTN
TO DO
THE DISPLAYING
01AD
FD4E23
01780
LD9
LD
C, (IY+RESULT+1-Y) ; # PICTURE LINES
01B0
ED4F
01790
LD
R.A
; IN FIRST LINE OF TEXT
0132
3EDD
01800
LD
A, -35
; VALUE FOR R IN SUBSEQUENT LINES
01B4
FB
01810
El
01B5
E9
01820
JP
(HL)
01830
;WILL
RETURN
TO CALLER
AT END OF PICTURE
For BASIC and machine code display Software, Post Office Box 3522,
games and routines, write ZETA Greenville, SC 29608.
DEAR EDITOR:
One of the reasons for
purchasing my ZX80 was an article
stating that Sinclair would produce
silicon chips for other high-level
languages such as COBOL, FORTRAN,
and ALGOL. Does Sinclair plan to
do this, or was someone just
speculating?
Bill Peckenpaugh, Gualala, CA
According to Nigel Searle of
Sinclair, there will be no Sinclair
chips for higher- level languages.
We would love to know where you saw
the article, though. --SB
I notice that you use the term
"Syntactic Sum" at the end of your
published programs — what does it
mean, and what usefulness is it to
programmers ?
Daniel Deadmore, Cleveland, OH
Syntactic Sum (Feb, 81, p.7) enables
you to check your input with SYNTAX
listings. In 4K machines, the
technique counts up all character
codes in ZX80 working space. 8K
Syntactic Sian counts number of
bytes used as well as character
codes. Type your program in, run
Syntactic Sum, and compare what you
got to what we list underneath the
program. If the two differ, you've
made a typo. --SB
I have a stereo cassette
player. When recording, I plug the
ZX80 output into the left channel
and a microphone into the right
channel. I first give the program
name on the cassette and then SAVE
the program on the left channel.
Then, when LOADing from
cassette, I leave the right speaker
connected to my stereo and connect
the ZX80 input to the other speaker
output. I hear myself announcing
the program, and the ZX80 alone
hears the "gosh- awful noise", as my
wife used to call it. When
cassettes are recorded this way,
you can still use them on a regular
portable cassette player.
Edward A. Goettman, Rochester, FA
I just recently constructed
MicroAce's 2K kit and found two
annoying bugs. The first problem,
ineffective video drive to 74LS00
gate, I fixed by changing C12 (47pF
disc ceramic capacitor) to lOOpF.
The other problem, difficulty
in typing some characters in from
the keyboard, I cured by pulling up
all keyboard columns with a 1/4-
watt lOkiZ resistor to +5V. I
mounted resistors on the MicroAce
board's foil side, one end
connected to the anode of the
diode, the other to a +5V trace
running adj acent to the diodes .
No problems now. Thanks to
Mr. Bill Clark and technicians at
MicroAce for their help.
William Kresl, Elkhorn, WI
If one makes a hardware
modification on a ZX80, how does
that affect the warranty?
John M. Morrison, Moores town, NJ
Hardware changes void the 90- day
warranty, says Sinclair. — SB
Since the computer uses bit
locale within 8 bytes to generate
characters, is there some way to
construct and display other unique
characters or modify the print
sequence so each pixel is not 1/4
of a character square but rather
1/64 of a square?
Tom Ros eland, Riverside, CA
Yes, but not simply. The bits are
stored in ROM, and we have not yet
8
found a way to divert the display
routine to look in RAH for data.
Using 4X or 8X high charac-
ters , you can create any shape you
wish by changing the source of data
from ROM to RAM. Just create bit
patterns in 8 consecutive locations
and change the PEEK address to read
your location instead of ROM. See
SON OF BIG CHARACTERS (Feb. 81).— KO
Upon testing my 8K ROM, I
discovered the same errors David
Shulman described (July 81, p.8).
I have sent for a replacement. My
concern: will programs taped on
the original 8K ROM work for the
replacement ROM?
Stephen Levy, Bowie, MD
Yes. According to Sinclair's Nigel
Searle, the changes won't affect
what the computer understands , just
what it does. — SB
*Dann Weldkamp, 321 S. 5th #216,
Ames, IA 50010 would like to hear
from users in his area. If you
would like to contact local ZX80/
MicroAce users, send us your name
and address. We'll publish them
when space permits.
SOFTWARE REVIEW
ZX80 DOUBLE BREAKOUT
Price:
RAM reqd:
ROM reqd:
Type of program:
Printed listing?
Program lis table?
Screen prompts?
Easy to load?
Challenge:
Display :
$14.95+$1. 50 SH
IK
4K
Game
No
No
Few
Yes
Flexible
Excellent
From: Softsync, Inc., P.0. Box 480,
Murray Hill Station, New York, NY
01058.
Creators of Double Breakout
somehow crammed a wonderfully
challenging, flicker- free game into
IK RAM. Problems with their first
game, Super ZX80 Invasion (May 81,
p.7), have largely been surmounted,
although memory still limits com-
puter/p layer interaction.
Softsync' s package includes a
cassette tape, one page of loading
instructions, and one page of
playing instructions, generally
well put-together. The cassette
contains two unlis table copies of
Double Breakout, and starting
instructions are printed on top.
As in Breakout, the object is
to demolish a wall. In this
version, two walls composed of
different display elements provide
you with something to destroy in
nine rounds. By means of shifted 5
and 8 keys , you move your bat up
and down the screen to deflect the
ball before it goes out of bounds .
LOADing, a big problem when
trying to play ZX80 Invasion, was
no trouble in Double Breakout. I
succeeded the first time, getting
100 REM on my screen.
After LOADing, I typed GO TO
1, just as both the cassette and
instructions told me. I then chose
from seven levels of difficulty,
ranging from very fast (1) to very
slow (7). Although I tried my best
to get the program to crash, the
computer ignored input other than
that necessary to move the bat up
and down on the screen.
Some aspects of play are
inconvenient, however. You cannot
end the game or change its level of
difficulty without turning off the
ZX80 and reLOADing the program.
The creators sacrificed a decent
running score to save memory --
only a small number in the upper
left comer of the screen reminded
me how many rounds I had left.
Otherwise, the display repre-
sents an incredible stretching of
ZX80 capabilities. Double Breakout
is sophisticated enough to satisfy
even hard-core video junkies.
9
NOW AVAILABLE
Keyboard .
x conversions
• Standard Computer Keyboard
• Type programs in half the time
• Minimize errors
• Wired keyboard hooks up in minutes
Plans for keyboard conversion with reverse video
$10.00
Keyboard with complete parts and plans*! now 155.00
Wired keyboard, complete with plans NOW 175.00
Add 15.00 mailing charge for continental U.S.
Other locations write for details.
L.J.H. Enterprises
P.O. Box 6273, Orange, CA 92667
Or cal 714/772-1505
One problem with creating
graphic displays on the ZX80 is
users' inability to interact with
display. This program allows you
to manipulate a cursor on 14 screen
lines and to insert characters
where desired.
The program operates in two
modes , each identified by the type
of cursor displayed. The asterisk
cursor indicates direction mode and
will accept the following commands :
R= cursor right U® cursor up
L= cursor left D= cursor down
1 - to insert mode S= stop program
(NL)= repeat last instruction
A question mark replaces the
asterisk as cursor to indicate that
the program has entered insert
mode. During insert mode, the
cursor continues to move in the
last direction entered in direction
mode. The command ND (for new
direction) shifts control from
insert back to direction mode. (NL)
repeats insertion of the last
character chosen and moves the
cursor to the next position. Any
other input is inserted as a
character at the cursor position.
Insert mode input can be
character codes (see p.75 of your
ZX80 manual) or single- character
keyboard symbols, except those
identified as not available (p. 117
of your manual -- these cause
interesting crashes).
You can move the asterisk
cursor beyond the side edges of the
display to alter characters in the
end horizontal positions (columns 1
and 32). If you move past the top
or bottom rows, however, you will
disrupt the display, but the
computer will still accept the R
command. When the ZX80 recovers,
you can use the top row.
Once you've entered the
program, type RUN (NL) . A screen
full of colons will appear: the
cursor will not be visible until
after you enter a direction command
(R,L,U, or D) . If you want to
modify the initial backgound,
change the 14 in line 150 to the
new symbol's character code.
This program runs in IK RAM;
if you have more memory, you can
expand display space by increasing
the second value of the loop on
line 100. Some alterations of the
program may affect the initial POKE
of the cursor, so check line 140.
Will Hiatt, Yakima, WA
100 FOR X=1 TO 448
110 PRINT "
120 NEXT X
130 LET N=20
140 LET Q=1 7083
150 LET C1=1 4
160 INPUT A$
170 LET X=CODE(A$)
180 LET A$ S TL$ (A$)
190 LET Y— CODE (A$)
200 LET Z=CODE(TL$(A$))
lO
210 LET F=0
220 IF N=20 THEN LET C=C1
230 IF X=1 THEN GO TO 330
240 IF N=20 THEN GO TO 300
250 IF Y=4 1 THEN GO TO 420
260 LET C=X* 1 00+Y* 1 O+Z-3 1 08
270 IF NOT Y=1 THEN LET F=2
280 IF Y=1 THEN LET C=X
290 GO TO 330
300 IF X=46 THEN GO TO 450
310 IF X=56 THEN STOP
320 LET D=X
330 IF D=55 THEN LET P=Q+1
340 IF D=49 THEN LET P=Q-1
350 IF D=58 THEN LET P=Q-33
360 IF D=4 1 THEN LET P=Q+33
370 POKE Q+F,C
380 LET C 1 =PEEK ( P+F )
390 POKE P+F ,N
400 LET Q=P
410 GO TO 160
420 LET N=20
430 LET F=1
440 GO TO 39 0
450 LET N=1 5
460 GO TO 390
Syntactic Sum: -20876, 4K
(NOTE: This program won't run with
Syntactic Sum LOADed. — SB)
BEGINNERS' LOADING ML PROGRAMS
This month we'll learn how to
put machine language (ML) programs
into your computer. You may not
tinders t and ML programs you use, but
following these directions, you can
load any ML program. We have 2
ways to do this , with decimal or
hexadecimal (hex) numbers .
In COMPUTER NUMBER SYSTEMS,
Mar. 81, we learned to convert
decimal numbers, our usual 1-10
counting system, into hex (or base
16) numbers, and vice versa. Far
from being just a math exercise,
this skill will now come in handy.
In June's SYNTAX, we saw that
BASIC command POKE A,B puts code B
into address A. POKE uses decimal
numbers. You can POKE decimal ML
code, just as we POKEd character
code. Try this simple ML program.
Here's the decimal listing for
a 4K ML program to add 45 and 15.
(It's easier, of course, to write a
BASIC program to do this, but we
need a simple example.)
62 45 46 15 141 111 38 0 201
LOAD the PLACING USR CALLS IN 4K,
8K program (Jun.81 p.8) for 4K;
use 1 for K. Our ML program has 9
commands, so use 9 for N, the
number of bytes to reserve. Now
you have RAM space that BASIC can't
touch (otherwise, the computer
could crash) .
USR CALLS gives our first
available RAM address as
16382-N+(1024*K) . In this case,
N=9 and K=l, so our first address
is 17399. Simply POKE the decimal
numbers one at a time into sequen-
tial RAM addresses, starting at
17399
10
>:
POKE
17399,62
20
POKE
17400,45
30
POKE
17401,46
40
POKE
17402,15
50
POKE
17403,141
60
POKE
17404,111
70
POKE
17405,38
80
POKE
17406,0
90
POKE
17407,201
100
PRINT
USR( 17399)
RUN
Don ' t worry right now what the
codes stand for. Lines 20 and 40
enter the numbers to add; change
these to add other numbers (whose
sum doesn't exceed 255). This way,
you can enter ML programs , whether
or not you know how they work.
It's pretty tedious typing all
those POKE statements; let's
program the computer to do some of
the work for us using a FOR- NEXT
loop (see FOR-NEXT Loops, Nov. 80):
10 FOR 1=0 TO 8
20 INPUT X
30 POKE 17399+1, X
40 NEXT I
50 PRINT USR( 17399)
RUN
You will get 9 input prompts. Type
each decimal number, hitting NL
after each. When you've entered
11
the last one, the answer to 45+15
will appear on the screen.
We can add BASIC frills to the
program by adding and changing the
following lines :
5 PRINT "ENTER DECIMAL NUMBER
S ONE AT A TIME. HIT NL AFTER
EACH . "
50 PRINT "45+15=" ;USR(17399)
We can also enter the ML
program in hex. Convert each
decimal number into hex, using Bill
Herron's decimal- to-hex conversion
programs (Mar. 81) or a hex calcu-
lator (or paper and pencil) .
Here's our hex listing:
3E 2D 2E OF 8D 6F 26 00 C9
Each hex number corresponds in
order to a decimal number.
To enter hex code directly,
use a BASIC program like Matthew
Johnson's Hex Monitor program (May
81). Again, reserve the 9 bytes
our program takes up. Type one
2- digit hex number in response to
each prompt from that program (each
number must have 2 digits; that's
why 0 is written as 00) . Just hit
(NL) after the "STORAGE LOCATIONS"
prompt. This program automatically
provides the USR call (line 50 in
our BASIC program above) .
The 4K Hex Monitor won't work
with an 8K ROM. You can POKE the
decimal listing in 8K, but use
these decimal numbers instead:
62 45 46 15 141 79 6 0 201
(Include line 50 's USR call at the
end. ) Two commands change because
of the differences between the 4K
and 8K ROM's USR command.
The POKE method may be easier
for beginners. If you have an
assembly with no decimal listing,
just change the hex numbers to dec-
imal and POKE them into addresses
you reserved using PLACING USR
CALLS. In SYNTAX assembly list-
ings, hex code is in the second
column of numbers. Remember that
hex numbers are always expressed in
2 digits, even when they only need
single digits (type 9 as 09, for
example) . So convert the hex num-
bers 2 digits at a time. If you
see a line like 3E40, read it as 2
hex numbers, 3E and 40.
STAR COUNT
Your assignment: assistant
Navigation Officer on the starship
Stellar Voyager, now en route to
distant galaxies. As a backup to
the ship Y s computer, you have been
trained to make a rapid visual
survey of the star patterns
projected on the ship's view-
screen. After each complete scan
of the star field, you must make an
estimate of the total number of
stars visible on the view screen.
Naturally, the ship's computer
has already made a meticulous star-
by-star count, but your visual
estimate is expected to tally
within 857o of the total reported by
computer sensors. Less than a 70%
score may mean that either you or
the sensors need replacing.
LOAD program and use RUN (NL)
to begin your first duty watch.
When a prompt appears , use NL to
begin the star scan. ZX80 will
show a schematic view of star
patterns ahead of the ship,
stopping to request your estimate
of the number of stars visible to
the naked eye. Enter the number of
your star count estimate and NL.
ZX80 will report the true star
count and your accuracy in percent
on this scan. NL again for a new
scan; press any key and NL to exit.
On subsequent scans (up to 5) , ZX80
also reports your running accuracy.
If you can get into the 90% brack-
et, you're on your way to a
brilliant career as interstellar
navigator.
Otis Imboden, Washington, DC
10 PRINT , " STAR COUNT"
20 CLEAR
30 LET R=0
40 LET W=0
45 FOR P=1 TO 5
50 INPUT B$
55 IF B$>" " THEN GO TO 300
12
* THE ZX 80 POCKET BOOK Jfc
by Trevor Toms
from Phipps Associates
Epsom, Surrey UK
Handy, spiral-bound reference paperback for 4K ROM covering:
• Review of ZX80 BASIC — what the ZX80 BASIC can & can't do
• Programming the ZX80 — how to best use your ZX80 BASIC
• Program & Data File Storage & Retrieval — how to avoid frustration and endless retyping
• Program Listings — 12 fun & useful programs + 4 handy subroutines
• BASIC Command Set — an alphabetical dictionary + examples & tricks
Plus Appendices covering Z80 op codes sorted by mnemonic, the ZX80 character code set, summaries of error codes &
BASIC commands.
$14.95 + 1.50 first class postage. All orders mailed same day as received. Avoid the delay and expense of overseas shipping
— order direct from SYNTAX. Send name, address, check or credit card number with expiration date to SYNTAX ZX80,
RD 2 Box 457 Bolton Road, Harvard, MA, 01451 or call 617/456-3661.
60 CLS
70 LET S=0
80 FOR 1=1 TO 429
100 GO TO 1 2 8+RND ( 1 6 ) * 2
145 PRINT CHR$ (128) ;
146 NEXT I
148 PRINT CHR$ (142) ;
149 LET S=S+2
159 NEXT I
160 PRINT CHR$ (155) ;
161 LET S=S+1
167 NEXT I
170 PRINT
179 PRINT "YOUR ESTIMATE..?";
180 INPUT A
185 PRINT A
190 PR5NT CLS
200 PRINT ," TRUE STAR COUNT* "
. g
210 IF A=S THEN GO TO 250
220 LET R=100- (100* (ABS (S-A) )/S
)
222 PRINT " ACCURACY* ";R;" PERC
ENT”
223 IF P=1 THEN LET W=R
224 IF P>1 THEN LET W=(W+R)/2 *
225 IF P>1 THEN PRINT "RATE* ";
W;" SCANS* ”;P
227 IF P=5 THEN GO TO 10
230 PRINT "NL FOR NEXT SCAN"
240 NEXT P
245 GO TO 300
250 PRINT " **** EUREKA. ..100 P
ERCENT ****"
300 STOP
Syntactic Sum: -20490, 4K
INPUT PORT
Our previous I/O hardware
article described an output device
addressed like memory. This month,
we'll capture data through a port,
placing it into a CPU register.
Your ZX80 or MicroAce uses a
Z80 CPU chip that can address 256
ports , one-byte locations through
which you can transfer data in or
out of the ZX80. You simply need a
tri- state gate and an address de-
coder. When the appropriate ad-
dress appears, the decoder signals
the gate to connect external data
with D0'-D7' lines of the Z80 bus
via the 46-pin connector at the
rear of your ZX80.
Port and memory addresses
differ, but the same number can
refer to a memory location or a
port. You r mac hine uses control
lines MREQ and IoRq to tell one
from another.
While the CPU requires 16 bits
to access memory locations, Z80
chips use only 8 bits to address
ports. Just AND the desi red combi-
nation of A0-A7 with lORQ and TO.
When this combination comes up on
the bus, the external buffer
connects the outside data to D0'-
D7'. Signals on the bus don't
conflict b ecau se input instructions
that send IORq tell the CPU to read
13
the bus rather than to co ntro l it.
After the allotted time, IORQ dis-
appears , and the external device
loses its connection with the bus.
You use a simple machine
language program, called from BASIC
with a USR statement, to read the
port and bring data into your
program from other devices .
4K ADDRESS
HEX
OPCODE
43FAh
DB7F
IN A, (127)
43FC
2600
LD H, 0
43FE
6F
LD L, A
43FF
C9
RETURN
DECIMAL :
219 127
38 0 111 201
(POKE origin at
17402)
8K ADDRESS
HEX
OPCODE
43FAh
DB7F
IN A, (127)
43FC
0600
LD B, 0
43FE
4F
LD C, A
43FF
C9
RETURN
DECIMAL :
219 127
6 0 79 201
(POKE origin at 17402)
Before loading the USR
routine, you must reserve RAM
space. For 4K machines, see PLAC-
ING USR CALLS (Jun. 81, p. 8) ; if you
have an 8K machine, you can move
RAMTOP down:
POKE 16388, 250
POKE 16389, 67
NEW (NL)
You can also assign data to an
array in a FOR- NEXT loop. This way
you can both read and store data
s imul taneous ly .
Because the ROM uses some
ports for display and tape opera-
tions, not all are available to us.
We used port number 127, but you
might want to explore other odd-
numbered ports.
You can use bits of the port
one at a time, or the entire byte
can represent a character. Thus,
the 8 bits could read 8 switches on
doors throughout your building or
two BCD digits from a digital
voltmeter. In fact, you can pack
information into the byte any way
you want- -unscramble it with a
program once it's in the machine.
Oi-icNico^invor^
O O P Q Q Q Q P
oo
vO
on
m
o\
AAAA
Si
rsi
m
CO
rsi
1
1 1
1 -
rH
rH
Q< 3 H<! hIH^WW
o
o
rH CN|
<N
CO CO o
CO
hMO
^ ^
i — r —
r —
o
i“H
CO
53
53
H
H
ph
PH
>
o
or^
O
rH CM
CM
CO CO O
CO
njl O
rH
o
CO
J3
CM
3
M
H
PH
PH
5V
14
ADDRESS i ► TO PINS 1 & 19 OF ► 74LS240 LATCH
DECODER
ML SCROLL ROUTINE
In IK ZX80s , large programs
easily overfill the 24 available
screen lines. This machine lang-
uage routine deletes the top line
from the screen so you can add
lines to the bottom.
To use with 4K ROM, first LOAD
Placing USR Calls (Jun.81) to
reserve RAM space at the top of
memory (this program uses 42 bytes;
your first address is 17366). POKE
in the Scroll routine, using the
decimal listing below, then LOAD or
type in a BASIC program.
Insert a USR call before each
PRINT line in your BASIC program.
A simple line like LET X=USR( 17366)
calls the ML routine but doesn't
affect what the computer prints
(don't use X or any variable you
choose elsewhere in your program) .
After you fill the screen, the
Scroll routine deletes 1 line from
the top of the display for each
line the program PRINTS at the
bottom. This listing will scroll
whenever the new line would be
printed on screen line 20 or below.
To change how many lines the rou-
tine PRINTS before scrolling,
adjust the fifth number of the
decimal listing. The number of
lines printed will be 25- (the fifth
decimal number) . If you call this
routine when the screen is empty,
the fifth number must be <24.
Ken Berggren, Louisville, KY
4K SCROLL ROUTINE
43D6
00100
ORG
43D6H
400 A
00110
DFILE
EQU
400 AH
400E
00120
DFEA
EQU
400EH
4025
00130
BOTLIN
EQU
4025H
0014
00140
SCROLL
EQU
14H
43D6
3A2540
00150
START
LD
A , (BOTLIN)
THE BOTTOM LINE
43D9
FE14
00160
CP
SCROLL
IF BOTLIN>SCROLL
43DB
F0
00170
RET
P
THEN RETURN TO BASIC
43DC
3C
00180
INC
A
ELSE ADD ONE
43 DD
322540
00190
LD
(BOTLIN) ,A
TO BOTLIN
43E0
2A0A40
00200
LD
HL, (DFILE)
WHERE TO START
43E3
7E
00210
LD
A, (HL)
(NL) IN A
43E4
54
00220
LD
D,H
PUT HL IN DE
43E5
5D
00230
LD
E,L
43E6
23
00240
INC
HL
FIRST CHAR IN FILE
43E7
EDB1
00250
CPIR
FIND NEXT (NL)
43E9
ED4B0E40
00260
LD
BC , (DFEA)
WHERE TO END
43ED
1801
00270
JR
SKIPHL
DO NOT INC HL
43 EF
23
00280
MOVBYT
INC
HL
43F0
13
00290
SKIPHL
INC
DE
43F1
7E
00300
LD
A , (HL)
;M0VE (HL) TO (DE)
43F2
12
00310
LD
(DE) ,A
43F3
78
00320
LD
A,B
COMPARE HL TO BC
43F4
94
00330
SUB
H
43F5
20F8
00340
JR
NZ, MOVBYT
IF BOH
43F7
79
00350
LD
A,C
43F8
95
00360
SUB
L
43F9
20F4
00370
JR
NZ, MOVBYT
IF C<>L
43FB
ED530E40
00380
LD
(DFEA) , DE
REPLACE DFEA
43FF
C9
00390
RET
RETURN TO BASIC
15
CLASSIFIED ADS
Got something to sell or swap? Or
are you looking for something
special? Use SYNTAX classifieds.
Reach hundreds of other readers for
just $2.75 per line (4- line min.).
Send your ad, typed 35 characters
per line, with payment by 15th of
any month for next month's issue to
Classified Ads, SYNTAX, RD 2 Box
457 Bolton Rd. , Harvard, MA 01451.
ASC-II to ZX-80 keyboard interface
Use your ASC-II & many other coded
keyboards (with mod) .Documentation
& PC board $25.00 Kit, includes
all patts with IC sockets & power
supply $59.95 Preferred Systems
16913 Rinaldi St, Granada Hills, CA
91344
Zilog Z 80 -CPU Z80A-CPU Technical
Manual, $7.50, and Z80-Assembly
Language Programming Manual,
$15.00. Add 57o for postage and
handling. Send check or credit
card no. to SYNTAX, RD 2 Box 457
Bolton Rd. , Harvard, MA 01451.
Need 8K R0M-16K RAM business progr-
am, 150 item's max, to identify name
mod #, pur chase & sale, dates & cost.
Rex Pedigo, 285 Sequoia Dr. Pasadena,
CA91105.0r call collect213-257-5610
Nov/Dec SYNTAX combined reprints,
$5, some other back issues avail-
able, $4 each. Send check or credit
card no. to SYNTAX, RD2 Box 457
Bolton Rd. , Harvard, MA 01451.
Programs -games & utility. Also
tech data, mods, plans, info, etc.
Send SASE for free goodies list.
P.0. Box 3073 San Jose, CA 95116
Sinclair's complete 4K ROM listing
available for $40. Send check or
credit card no. to SYNTAX, RD 2 Box
457 Bolton Rd, Harvard, MA 01451.
DISASSEMBLER PROGRAM CASSETTE for
8K ROM, 16K RAM. Displays Z80
nmemonics, calculates j umps, names
8K- system variables. Reads ROM or
your programs. Learn, write,
debug Z80 code with one-stepper
that shows registers & flags for
painless ML programming. Intro
offer $10 ppd US, $14 air abroad.
Sinware, Box 323, Dixon, NM 87527
ZX80 PORTS USED IN 8K ROM
IN: 221, 232, 254
OUT: 253, 255
BOTH IN AND OUT: 251 and 254
In 8K, use A$(2 TO) (shift 4) to
replace TL$(A$). This saves 3
bytes, says John Sampson of NY.
THE
H\R\ARD
GROLP
Bolton Road, Harvard, Mass. 01451
First Class